package com.example.back.controller;


import com.example.back.dto.req.BlacklistIpListsReq;
import com.example.back.dto.resp.BlacklistIpListsResp;
import com.example.back.service.BlacklistIpService;
import com.example.common.support.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = "IP黑名单")
@RequestMapping("/DSys/BlacklistIp")
public class BlacklistIpController {

    @Resource
    BlacklistIpService blacklistIpService;

    @ApiOperation(value = "获取IP黑名单列表", notes = "获取IP黑名单列表")
    @PostMapping(value = "/list")
    public Result<PageInfo<BlacklistIpListsResp>> list(@RequestBody BlacklistIpListsReq req) {
        return Result.success(blacklistIpService.list(req));
    }

    @ApiOperation(value = "新增黑名单IP", notes = "新增黑名单IP")
    @PostMapping(value = "/commitSave")
    public Result<Object> commitSave(@RequestBody BlacklistIpListsReq req) {
        return Result.success(blacklistIpService.commitSave(req));
    }

    @ApiOperation(value = "删除IP黑名单", notes = "删除IP黑名单")
    @PostMapping(value = "/commitDel")
    public Result<Object> commitDel(@RequestBody BlacklistIpListsReq req) {
        return Result.success(blacklistIpService.commitDel(req));
    }
}
